import java.io.BufferedWriter;
import java.io.FileWriter;
import java.io.IOException;


public class SaeifA {
	private BurningForstSimulation simulation;
	
	private double g=0.05;

	
	public void startTest() throws IOException {
        BufferedWriter out = new BufferedWriter(new FileWriter("out.txt"));
        
        
		while (g <=1){
			doSimulation();
			double measure = simulation.getGlobalMeasure();
			System.out.println("g="+g + " global measure is  " +measure);
	        out.write(g+";"+measure+"\r\n");
	        out.newLine();	
			g = g+0.05;
			
		}
		out.flush();
		out.close();
	}
	private void doSimulation() {
		simulation=  new BurningForstSimulation();
		simulation.d_plantingProb=1;
		simulation.f_lightningStrikeProb=0;
		simulation.p_growNewPlantProb=0;
		simulation.g_combustibilityProb=g;
		
		simulation.initCellularAutomatonWithTreesCol();
		
		int gen = 0;
		while (gen<Constants.GENERATION_LIMIT) {
			simulation.evolveToNextGeneration();
			gen++;
		}
		
	}
}
